package com.wjk.kylin.id.core.spring.boot.autoconfigure.kid;

import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @author wjk
 */
@ConfigurationProperties(prefix = "kylin.id.kid")
public class KIdProperties {
    /**
     * 是否启动rpc 服务消费者，默认不启用
     */
    private boolean enable = false;

    /**
     *
     */
    private String token;

    /**
     * 阈值 取值范围 0-1
     * 将要使用完id时，提前请求获取下一批次id
     * 当 id >= loadId 时，异步请求获取下一批次的id
     * loadId =  (maxId - beginId) * loadIdThreshold
     */
    private double loadIdThreshold = 0.5;


    public boolean isEnable() {
        return enable;
    }

    public void setEnable(boolean enable) {
        this.enable = enable;
    }


    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public double getLoadIdThreshold() {
        return loadIdThreshold;
    }

    public void setLoadIdThreshold(double loadIdThreshold) {
        this.loadIdThreshold = loadIdThreshold;
    }

    @Override
    public String toString() {
        return "IdConfigProperties{" +
                "enable=" + enable +
                ", token='" + token + '\'' +
                ", loadIdThreshold=" + loadIdThreshold +
                '}';
    }
}
